import Vue from 'vue';
Vue.directive('metis-menu', function (el) {
  let $homeMenuTree = $(el), metisMenuDataKey = 'metisMenu';
  if ($homeMenuTree.data(metisMenuDataKey)) {
    $homeMenuTree.metisMenu('dispose');
  }
});
Vue.directive('dragable',(el,data)=>{
  let obj = el;
  obj.onmousedown = function(ev) {
    let oevent = ev || event;
    let distanceX = oevent.clientX - obj.offsetLeft;
    let distanceY = oevent.clientY - obj.offsetTop;
    document.onmousemove = function (ev) {
      let oevent = ev || event;
      obj.style.left = oevent.clientX - distanceX + 'px';
      obj.style.top = oevent.clientY - distanceY + 'px';
    };
    document.onmouseup = function () {
      document.onmousemove = null;
      document.onmouseup = null;
    };
  }
});
